package com.itheima.a01inetaddressdemo;

import java.net.InetAddress;
import java.net.UnknownHostException;

public class MyInetAddressDemo1 {
    public static void main(String[] args) throws UnknownHostException {
        //网络编程
        //获取IP对象
        InetAddress address = InetAddress.getByName("192.168.137.1");
        System.out.println(address);

        //获取IP地址的主机名
        System.out.println(address.getHostName());

        //获取IP地址
        System.out.println(address.getHostAddress());
    }
}
